package model;

import java.util.List;

import javax.faces.model.ListDataModel;

import org.primefaces.model.SelectableDataModel;

@SuppressWarnings("unchecked")
public class VinculacaoEmprestimoLojaDataModel extends ListDataModel<Vinculacao> implements SelectableDataModel<Vinculacao> {

	@Override
	public Vinculacao getRowData(String rowKey) {
		List<Vinculacao> vinculacoes  = (List<Vinculacao>) this.getWrappedData();

		for(Vinculacao vinculacao : vinculacoes) {  
            if(vinculacao.getId().equals(rowKey))  
                return vinculacao;  
        }  
          
        return null;  
	}

	@Override
	public Object getRowKey(Vinculacao vinculacao) {
		return vinculacao.getId();
	}

}
